Labels:text | letter | screenshot | font | number | document OCR: Method Description CG The most common method, especially if written in a portable language such as Perl, but CGI (Common Gateway Interface) often suffers from process overhead. Process overhead can be reduced by writing native executables; or even further by using a server that runs Perl as an in- process library (this can be done with Apache under UNIX, and Internet Information Server under Windows NT). It's easy to write d non portable CGI progtam by calling native system functions or implicitly relying on system behaviors The APis available depend on the language and environ: ment of the COt, so one often has to rade portability for capability (for example, session tracking 'must be done by hand with cookies and sharing dato and coordinating tasks among instances must be done through the underlying os) WincGI An early hack to allow writing CGIs in Visual Basic, which didn't have casy access to STDIN and environment variables: It requires not only the process overhead of CGI, but also file I/O overhead of reading and writing the files used to pass informotion "Because it is neither portable nor opti+ mal, and since all servers that support it also support GGI and other methods, and since die hard VE programmers can while COM objects and call them from' Active Server Pages (ASP) ,; there is very little reason to recommend it FastCGI A single-socket protocol for passing data between a program and the Web server. Not supported by many servers (though it is theoretically more portable than servlets; being language:indepen; dent). Eliminates process overhead of (G), but retains the same portability capability tradeoffs; ISAPI/NSAPI These are APls for attaching in-process libraries in a server-specific way. The least portable method. of all, but also the most powerful, because methods can be invoked on many events, not only HTTP requests. Most useful for enabling other more portable services.for example,the ASP engine ond Servlet enigine gra watten using ISAPI, Along with power comes risk: @ isn't hord to write an ISAPI extension that crashes the server SSI Server-side includes are a handy:and simple way to make dynamic --- but not interactive .--- pages Can include several per page,'but can't process form data: Same portability as CGI Useful for things like dato: filed tablese where process bverhead is masked by database I/O overhead anyway; ASP Powerful and easy to learn, but can get very complicated. Requires the use of COM objects to do seri- ous processing. Rich APls, for session, trocking, database connections, content rotation, and other tasks Not very portable (one limited UNIX implementation and a few non-IIS/NT ones are available from Chilisoft):'Filet/Orand interpreter overhead per request, Multithreading and data sharing are difficult. Servlets Requires one-time startup cost of the JVM, but there's no process or I/O overhead afterward. There are many benefits: It's easy to share data among various servlets running under a single VM; it's easy to synchronize access to resources; and session tracking, (with the 1.2 API) is also easy. It's, also a very portable solution (e.g. Sun and Apache servers on UNIX, Live Software's JRun for most Windows IT servers, Sun server on Mack All Java APls are available, so it's easy to do even pow: erful things-such as multithreading; portably For those vare occasions where even the Java APIs are insufficient native methods or I/ Direct can be used. JavaServlet Java versions of ASP and SSI. Can imbed arbitrary Java code within HTML that makes use of Pages/ request, response; and session objects. < SERVLET > fags are interpreted at request time, so they <SERVLET> tag have the file I/O cost of $SI without the process cost. JSP (Java Servlet Pages) code is compiled into anonymous Java servlets that run as fast as hand written servlets, so they are g' simpler language for doing the same thing Figure 1: Comparison of server-side methods.